package builderPattern;

/**
 * 每一行代码，都是改变世界的力量
 *
 * @author 郭帅
 * @date 2022/12/16 13:50
 */
public class Person {

    private String name;

    private Integer age;

    private String gender;

    private String tail;

    private String weight;

    public Person() {
    }

    public Person(String name, Integer age, String gender, String tail, String weight) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.tail = tail;
        this.weight = weight;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                ", tail='" + tail + '\'' +
                ", weight='" + weight + '\'' +
                '}';
    }

    public static class PersonBuilder {
        public String name;

        public Integer age;

        public String gender;

        public String tail;

        public String weight;

        PersonBuilder name(String name) {
            this.name = name;
            return this;
        }


        PersonBuilder age(Integer age) {
            this.age = age;
            return this;
        }

        PersonBuilder gender(String gender) {
            this.gender = gender;
            return this;
        }

        PersonBuilder tail(String tail) {
            this.tail = tail;
            return this;
        }

        PersonBuilder weight(String weight) {
            this.weight = weight;
            return this;
        }

        Person build() {
            return new Person(this.name, this.age, this.gender, this.tail, this.weight);
        }
    }
}
